package org.example.utils;

import java.io.IOException;
import java.net.JarURLConnection;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;

public class JarVersionUtil {

    public static void main(String[] args) throws IOException {
        String version = "Unknown version";
        String jarFileName = "D:\\works\\gitbucket\\toss_asahiint\\Source\\WEB-INF\\lib\\struts.jar";
        JarFile jarFile = new JarFile(jarFileName);
        Manifest manifest = jarFile.getManifest();
        if (manifest != null) {
            Attributes attributes = manifest.getMainAttributes();
            version = attributes.getValue("Implementation-Version");
        }
        System.out.println(version);
    }

}
